﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using WebService.Connect;
using System.Data.SqlClient;
using Model;
using System.Data;


namespace WebService.Datalayer
{
    public class DBHistoryMenus
    {
        Database db = new Database();
        SqlParameter[] listParameter;

        /// <summary>
        /// SelectHistoryMenusAll
        /// </summary>
        /// <returns></returns>
        public DataSet SelectHistoryMenusAll()
        {
            return db.GetDataset("sp_SelectHistoryMenusAll");
        }

        /// <summary>
        /// SelectHistoryMenusByAndHistoryMenuID
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public DataSet SelectHistoryMenusByAndHistoryMenuID(HistoryMenus obj)
        {
            listParameter = new SqlParameter[]
            {
                new SqlParameter("@HistoryMenuID", obj.HistoryMenuID),
            };
            return db.GetDataSetWithParameter("sp_SelectHistoryMenusByAndHistoryMenuID", listParameter);
        }

        /// <summary>
        /// DeleteHistoryMenu
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int DeleteHistoryMenu(HistoryMenus obj)
        {
            listParameter = new SqlParameter[]
            {
                new SqlParameter("@HistoryMenuID", obj.HistoryMenuID),
            };
            return db.ExcuteQueryWithParamater("sp_DeleteHistoryMenu", listParameter);
        }

        /// <summary>
        /// SelectHistoryMenusByAndMenuID
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public DataSet SelectHistoryMenusByAndMenuID(HistoryMenus obj)
        {
            listParameter = new SqlParameter[]
            {
                new SqlParameter("@MenuID", obj.MenuID),
            };
            return db.GetDataSetWithParameter("sp_SelectHistoryMenusByAndMenuID",listParameter);
        }

        /// <summary>
        /// InsertHistoryMenu
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int InsertHistoryMenu(HistoryMenus obj)
        {
            listParameter = new SqlParameter[]
            {
                new SqlParameter("@HistoryMenuID", obj.HistoryMenuID),
                new SqlParameter("@MenuID", obj.MenuID),
                new SqlParameter("@Price", obj.Price),
                new SqlParameter("@CreateDate", obj.CreateDate),
                new SqlParameter("@IsDeleted", obj.IsDeleted),
            };
            return db.ExcuteQueryWithParamater("sp_InsertHistoryMenu", listParameter);
        }

        /// <summary>
        ///  UpdateHistoryMenu
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int UpdateHistoryMenu(HistoryMenus obj)
        {
            listParameter = new SqlParameter[]
            {
                new SqlParameter("@MenuID", obj.MenuID),
                new SqlParameter("@Price", obj.Price),
                new SqlParameter("@CreateDate", obj.CreateDate),
                new SqlParameter("@IsDeleted", obj.IsDeleted),
                new SqlParameter("@HistoryMenuID", obj.HistoryMenuID),
            };
            return db.ExcuteQueryWithParamater("sp_UpdateHistoryMenu", listParameter);
        }




           
    }
}